Skip to content

Fix build failure with ICX 2026 on Windows#211

Open
xaleryb wants to merge 1 commit into
IntelPython:mainfrom
xaleryb:fix/icx2026-windows-complex-type
Open

Fix build failure with ICX 2026 on Windows#211
xaleryb wants to merge 1 commit into
IntelPython:mainfrom
xaleryb:fix/icx2026-windows-complex-type

Conversation

@xaleryb
Copy link
Copy Markdown
Contributor

@xaleryb xaleryb commented May 21, 2026

Problem

ICX 2026 on Windows strictly enforces that C99 _Complex double cannot be passed to UCRT's creal()/cimag() functions, which expect _Dcomplex (an MSVC struct type). This causes hard compilation errors in all three build targets (mkl_umath_loops, _ufuncs, _patch_numpy).

Root cause chain:

  1. CMakeLists.txt sets C_STANDARD 99 → CMake injects -Qstd:c99 for ICX
  2. With -Qstd:c99, ICX enables strict C99 complex type semantics
  3. numpy's npy_common.h defines npy_cdouble as double _Complex for __INTEL_LLVM_COMPILER (regardless of platform)
  4. numpy's npy_math.h calls creal(z) / cimag(z) where z is npy_cdouble
  5. UCRT's creal() expects _Dcomplex — ICX 2025 emitted a warning, ICX 2026 makes it a hard error

This is why Intel's own CI did not catch this: Intel's channel provides dpcpp_win-64 2025.x which was lenient. conda-forge uses dpcpp_win-64 2026.0 which enforces strict types.

Fix

Unset C_STANDARD for all three targets when building on Windows with IntelLLVM. Without -Qstd:c99, ICX operates in its default clang-cl compatibility mode and handles the _Complex/_Dcomplex coercion without error — matching the behavior of ICX 2025 and earlier.

if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
  set_target_properties(<target> PROPERTIES C_STANDARD "")
endif()

Note

The underlying incompatibility is in numpy's npy_math.h, which should guard creal/cimag calls for __INTEL_LLVM_COMPILER on Windows — similar to how npy_common.h already guards the npy_cdouble typedef. This fix works around it at the mkl_umath build level until numpy addresses it upstream.

ICX 2026 in clang-cl mode strictly enforces that C99 _Complex double
cannot be passed to UCRT's creal/cimag functions which expect _Dcomplex
(an MSVC struct type). This causes hard compilation errors in all three
build targets when C_STANDARD 99 is set, because CMake translates that
to -Qstd:c99 for ICX, enabling strict C99 complex type semantics.

numpy's npy_common.h defines npy_cdouble as 'double _Complex' for
IntelLLVM compilers regardless of platform. numpy's npy_math.h then
calls creal()/cimag() on npy_cdouble values. Under ICX 2025 this was
a warning; under ICX 2026 it is a hard error.

Fix: on Windows with IntelLLVM, unset C_STANDARD for all three targets
so CMake does not inject -Qstd:c99. ICX in its default clang-cl
compatibility mode handles the _Complex/_Dcomplex coercion without
error, matching the behavior of ICX 2025 and earlier.

Note: the underlying incompatibility is in numpy's npy_math.h which
should guard creal/cimag calls for __INTEL_LLVM_COMPILER on Windows,
similar to how npy_common.h already guards the npy_cdouble typedef.
@xaleryb xaleryb force-pushed the fix/icx2026-windows-complex-type branch from f4401aa to 68e9116 Compare May 21, 2026 00:36
xaleryb added a commit to xaleryb/mkl_umath that referenced this pull request May 21, 2026
Validates that the ICX 2026 fix works under the same channel configuration
that conda-forge uses. Remove once PR IntelPython#211 is merged.
xaleryb added a commit to xaleryb/mkl_umath that referenced this pull request May 21, 2026
Validates that the ICX 2026 fix works under the same channel configuration
that conda-forge uses. Remove once PR IntelPython#211 is merged.
@xaleryb xaleryb force-pushed the fix/icx2026-windows-complex-type branch 2 times, most recently from d55b754 to 68e9116 Compare May 21, 2026 02:22
@ndgrigorian
Copy link
Copy Markdown
Collaborator

@xaleryb
The meson-python build PR does not show this problem without the workaround:
https://github.com/IntelPython/mkl_umath/actions/runs/25949137641/job/76283388303?pr=166
and uses 2026.0 Windows compiler.

It does update how the loop generation works, though, so I'm not sure -- it's possible that this solution is still correct. We can try to build locally, or also, it would be good to drop the fix commit in this PR temporarily and see if CI passes.

If it does, it means there may be something specific to conda-forge or a recipe issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants